﻿using System;
using System.Windows.Forms;
using CodeStandardAddin.Properties;

namespace CodeStandardAddin.View
{
	public partial class ConfigurationForm : Form
	{
		#region Constructor ---------------------------------------------------------------------------

		public ConfigurationForm()
		{
			InitializeComponent();
		}

		#endregion Constructor ------------------------------------------------------------------------


		#region Methods -------------------------------------------------------------------------------

		public void LoadCodeFormat()
		{
			//TODO: reload code format
		}

		#endregion Methods ----------------------------------------------------------------------------


		#region Functions -----------------------------------------------------------------------------
		
		protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (buttons.Changed)
			{
				DialogResult result = MessageBox.Show(Settings.Default.Message_ConfirmApplyChanges, Settings.Default.AppTitle,
					MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
				if (result == DialogResult.Yes)
				{
					Buttons_ApplyClick(buttons, new SuccessEventArgs());
					buttons.Changed = false;
				}
				else if (result == DialogResult.Cancel)
				{
					e.Cancel = true;
				}
			}
		}


		#region Buttons' functions --------------------------------------------------------------------
		
		private void Buttons_ExportClick(object sender, FormatFileEventArgs e)
		{
			//TODO
		}

		private void Buttons_ImportClick(object sender, FormatFileEventArgs e)
		{
			//TODO
		}

		private void Buttons_ApplyClick(object sender, SuccessEventArgs e)
		{
			//TODO
		}

		private void Buttons_CloseForm(object sender, EventArgs e)
		{
			this.Close();
		}

		#endregion Buttons' functions -----------------------------------------------------------------


		private void ConfigurationControl_ConfigChanged(object sender, EventArgs e)
		{
			//TODO
		}

		#endregion Functions --------------------------------------------------------------------------
	}
}